lx_cade saida			796_MULTIMARCA TEMPORARIO
SELECT * FROM LOJA_SAIDAS WHERE SUBSTRING(FILIAL,1,3) = '110' AND NUMERO_NF_TRANSFERENCIA like '%736950'
SELECT * FROM FATURAMENTO_IMAGEM WHERE NUMERO_FISCAL like '%736950' order by filial

SELECT * FROM LOJA_NOTA_FISCAL WHERE CODIGO_FILIAL = '000796' AND NF_NUMERO like '000917'

SELECT * FROM FATURAMENTO_IMAGEM WHERE SUBSTRING(FILIAL,1,3) = '080' AND NUMERO_FISCAL like '%6065'

SELECT * FROM loja_ENTRADAS WHERE NUMERO_NF_TRANSFERENCIA like '%194630'
SELECT * FROM FATURAMENTO_IMAGEM WHERE NUMERO_FISCAL like '%03181'


SELECT * FROM FATURAMENTO_IMAGEM 
WHERE SUBSTRING(FILIAL,1,3) = '123' 
AND DATEPART(YYYY,EMISSAO) =2008
order by numero_fiscal

SELECT * FROM FATURAMENTO_IMAGEM_prod 
WHERE SUBSTRING(FILIAL,1,3) = '025' AND NUMERO_FISCAL like '%9135'

SELECT * FROM FATURAMENTO_IMAGEM 
WHERE SUBSTRING(FILIAL,1,3) = '517' AND NUMERO_FISCAL like '%009%' order by numero_fiscal


SELECT *  FROM LOJA_NOTA_FISCAL
WHERE CODIGO_FILIAL = '000123' and EMISSAO >= '20080701'

SELECT * FROM FATURAMENTO WHERE SUBSTRING(FILIAL,1,3) = '999' and nf_saida like '%194630'
AND CAST(nf_saida AS INT)  = 194630 AND DATEPART(YYYY,EMISSAO) =2008



begin transaction
UPDATE FATURAMENTO SET Nome_clifor = '796_MULTIMARCA TEMPORARIO'
WHERE filial = '999_CDLOJAS' and nf_saida = '194630 '
commit
rollback

SELECT * FROM FATURAMENTO_IMAGEM WHERE FILIAL = '015_MARCONI'AND
NUMERO_FISCAL LIKE '000042%'AND DATEPART(YYYY,EMISSAO) =2008 order by numero_fiscal

Select * from LOJA_ENTRADAS WHERE SUBSTRING(FILIAL,1,3) = '080' 
AND DATEPART(YYYY,EMISSAO) =2008 order by numero_nf_transferencia

begin transaction
delete FATURAMENTO_IMAGEM WHERE SUBSTRING(FILIAL,1,3) = '015' AND DATEPART(YYYY,EMISSAO) =2008
AND NUMERO_FISCAL like '000000%'
commit
rollback

SELECT * FROM FATURAMENTO_IMAGEM 
WHERE SUBSTRING(FILIAL,1,3) = '015' 
AND DATEPART(YYYY,EMISSAO) =2008
AND NUMERO_FISCAL like '0000%'

SELECT * FROM loja_ENTRADAS WHERE SUBSTRING(FILIAL,1,3) = '080' AND NUMERO_NF_TRANSFERENCIA like '%0836'
SELECT * FROM loja_ENTRADAS WHERE SUBSTRING(FILIAL,1,3) = '080' ORDER BY FILIAL_ORIGEM
SELECT * FROM loja_ENTRADAS WHERE NUMERO_NF_TRANSFERENCIA like '%7108'

begin transaction
UPDATE loja_ENTRADAS SET filial = '796_MULTIMARCA TEMPORARIO'
WHERE NUMERO_NF_TRANSFERENCIA = '000836' AND FILIAL_ORIGEM = '080_LOJINHA - CENTRAL'
commit
rollback


SELECT * FROM loja_ENTRADAS WHERE SUBSTRING(FILIAL,1,3) = '125' AND NUMERO_NF_TRANSFERENCIA like '%372'
SELECT * FROM loja_ENTRADAS WHERE SUBSTRING(FILIAL,1,3) = '102' ORDER BY FILIAL_ORIGEM
SELECT * FROM loja_ENTRADAS WHERE NUMERO_NF_TRANSFERENCIA like '%736950'

begin transaction
UPDATE loja_ENTRADAS SET FILIAL_ORIGEM = '796_MULTIMARCA TEMPORARIO'
WHERE SUBSTRING(FILIAL,1,3) = '102' AND NUMERO_NF_TRANSFERENCIA = '00037345' AND FILIAL_ORIGEM = '080_LOJINHA - CENTRAL'
commit
rollback


SELECT * FROM LOJA_SAIDAS WHERE SUBSTRING(FILIAL,1,3) = '141' AND NUMERO_NF_TRANSFERENCIA like '%37109'
SELECT * FROM LOJA_SAIDAS WHERE SUBSTRING(FILIAL,1,3) = '141' ORDER BY NUMERO_NF_TRANSFERENCIA
SELECT * FROM LOJA_SAIDAS WHERE NUMERO_NF_TRANSFERENCIA like '%6075' ORDER BY FILIAL

begin transaction
UPDATE LOJA_SAIDAS SET FILIAL = '796_MULTIMARCA TEMPORARIO'
WHERE SUBSTRING(FILIAL,1,3) = '080' AND NUMERO_NF_TRANSFERENCIA = '037109  ' 
AND FILIAL_DESTINO = '080_LOJINHA - CENTRAL'
commit
rollback


SELECT * FROM LOJA_SAIDAS_PRODUTO WHERE SUBSTRING(FILIAL,1,3) = '796' AND ROMANEIO_PRODUTO = 'LHFJK15M'

UPDATE LOJA_SAIDAS SET FILIAL = '796_MULTIMARCA TEMPORARIO'
WHERE SUBSTRING(FILIAL,1,3) = '080' AND NUMERO_NF_TRANSFERENCIA = '00005383' 


SELECT * FROM LOJA_SAIDAS WHERE SUBSTRING(FILIAL,1,3) = '110' AND NUMERO_NF_TRANSFERENCIA like '%2311'

begin transaction
UPDATE LOJA_SAIDAS SET NUMERO_NF_TRANSFERENCIA = '002311'
WHERE SUBSTRING(FILIAL,1,3) = '110' AND NUMERO_NF_TRANSFERENCIA = '736950' 
commit
rollback


SELECT * FROM FATURAMENTO_IMAGEM WHERE NUMERO_FISCAL like '%02311' order by filial

begin transaction
UPDATE FATURAMENTO_IMAGEM SET NUMERO_FISCAL = '002311'
WHERE SUBSTRING(FILIAL,1,3) = '110' AND NUMERO_FISCAL like '%736950'
commit
rollback
